Class com.symantec.itools.vcafe.openapi.Range
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.symantec.itools.vcafe.openapi.Range

Object
   |
   +----com.symantec.itools.vcafe.openapi.Range

public final class Range
extends Object
A byte offset and length in a SourceFile. It is not the range of the unicode version of that text. Note that this means that a Range cannot be computed arbitrarily from the unicode StringBuffer equivalent text. Ranges are meant to be passed from Visual Cafe to plug-ins, and not vice-versa.

Version:
1.0
Author:
Symantec Internet Tools Division
Since:
VCafe 3.0
See Also:
SourceFile

Constructor Index

 o com.symantec.itools.vcafe.openapi.Range(int, int)
Constructs a Range that starts at the specified character position (in bytes), and has the given length (also in bytes).
 o com.symantec.itools.vcafe.openapi.Range(Range)
Constructs a Range that has the same start and length as the given Range.

Method Index

 o contains(int)
Determines whether the extent of this Range contains the specified offset.
 o contains(Range)
Determines whether this Range fully contains the give Range r.
 o equals(Range)
Determines whether this Range has the identical extent as the given Range.
 o getDistance(int)
Determines the absolute distance of the given offset from this Range.
 o getEnd()
Determines the ending character position, in zero-based bytes.
 o getLength()
Gets the length.
 o getStart()
Gets the starting character position, in zero-based bytes.
 o isEmpty()
Determines whether the range is empty (Range length is zero).
 o toString()
Gets a String that represents this object.
 o union(Range)
Creates a new Range that contains the full extend of both this and the given Range.

Constructors

 o Range
public Range(int start,
             int length)
Constructs a Range that starts at the specified character position (in bytes), and has the given length (also in bytes).

Parameters:
start - starting character position in bytes, numbering from zero.
length - length of the range in bytes.
 o Range
public Range(Range r)
Constructs a Range that has the same start and length as the given Range.

Parameters:
r - the given Range.

Methods

 o contains
public boolean contains(int offset)
Determines whether the extent of this Range contains the specified offset.

Parameters:
offset - the offset, in zero-based bytes.
Returns:
true if this Range contains the offset, false otherwise.
 o contains
public boolean contains(Range r)
Determines whether this Range fully contains the give Range r.

Parameters:
r - the given Range.
Returns:
true if the given Range is fully contained by this Range, false otherwise.
 o equals
public boolean equals(Range r)
Determines whether this Range has the identical extent as the given Range.

Parameters:
r - the given Range.
Returns:
true if the extents are the same, false otherwise.
 o getDistance
public int getDistance(int offset)
Determines the absolute distance of the given offset from this Range. If the offset is contained within the extent of this Range, 0 is returned.

Parameters:
offset - the given offset
Returns:
the offset's absolute distance away, or 0 if the offset is contained by this Range.
 o getEnd
public int getEnd()
Determines the ending character position, in zero-based bytes.

Returns:
the ending character position in bytes, in zero-based based.
 o getLength
public int getLength()
Gets the length.

Returns:
the length of this Range in bytes.
 o getStart
public int getStart()
Gets the starting character position, in zero-based bytes.

Returns:
the start of this Range in zero-based bytes.
 o isEmpty
public boolean isEmpty()
Determines whether the range is empty (Range length is zero). If this is true, this Range is an insertion point, otherwise it is an area of text.

Returns:
true if the range is empty.
 o toString
public java.lang.String toString()
Gets a String that represents this object.

Returns:
the String.
Overrides:
toString in class Object
 o union
public com.symantec.itools.vcafe.openapi.Range union(Range r)
Creates a new Range that contains the full extend of both this and the given Range.

Parameters:
r - the given Range (may be null).
Returns:
a new Range whose extent contains both this and the given Range.

All Packages  Class Hierarchy  This Package  Previous  Next  Index